Skip to content

Conversation

@Cozmopolit
Copy link

@Cozmopolit Cozmopolit commented Dec 4, 2025

Description

Adds support for Azure-hosted Anthropic models (Azure AI Foundry).
Azure requires api-key header instead of x-api-key.

Fixes #9009

Checklist

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created
  • The relevant tests, if any, have been updated or created

Tests

Added unit tests in AnthropicUtils.test.ts for:

  • Azure endpoint detection (URL parsing)
  • Correct header selection (api-key vs x-api-key)
  • Key/endpoint mismatch warning

Summary by cubic

Support Azure-hosted Anthropic endpoints by detecting Azure API base URLs and using the required api-key header. Maintains prompt caching behavior and adds a warning for key/endpoint mismatches.

  • Bug Fixes
    • Detect Azure endpoints (*.services.ai.azure.com, *.cognitiveservices.azure.com) and switch from x-api-key to api-key.
    • Update getAnthropicHeaders to accept apiBase; pass through in core Anthropic and adapter code.
    • Add unit tests for endpoint detection, header selection, caching header, and mismatch warning.

Written for commit 9e8bfcd. Summary will update automatically on new commits.

@Cozmopolit Cozmopolit requested a review from a team as a code owner December 4, 2025 21:37
@Cozmopolit Cozmopolit requested review from Patrick-Erichsen and removed request for a team December 4, 2025 21:37
@continue
Copy link
Contributor

continue bot commented Dec 4, 2025

Keep this PR in a mergeable state →

Learn more

All Green is an AI agent that automatically:

✅ Addresses code review comments

✅ Fixes failing CI checks

✅ Resolves merge conflicts

1 similar comment
@continue-development-app
Copy link

Keep this PR in a mergeable state →

Learn more

All Green is an AI agent that automatically:

✅ Addresses code review comments

✅ Fixes failing CI checks

✅ Resolves merge conflicts

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Dec 4, 2025
@github-actions
Copy link

github-actions bot commented Dec 4, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@continue
Copy link
Contributor

continue bot commented Dec 4, 2025

Documentation Updates

Added a new section to the Anthropic provider documentation explaining Azure AI Foundry configuration:

  • New "Azure AI Foundry" section in docs/customize/model-providers/top-level/anthropic.mdx
  • Documents how to configure apiBase parameter for Azure-hosted Anthropic endpoints
  • Includes both YAML and JSON (deprecated) configuration examples
  • Notes automatic detection and correct authentication header usage (api-key vs x-api-key)

The documentation maintains the same level of detail as the existing sections and follows the established format.

@Cozmopolit
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

@Cozmopolit
Copy link
Author

I truly hope I did not step on anyone's toes by submitting both bug issue and PR around the same time - that was not my intent.

Keep up the great work, ty

Cozmo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Bug: Anthropic provider fails with Azure AI Foundry endpoints (incorrect auth header)

1 participant